In a cloud storage system, data is stored in a single cluster. To improve data storage security and provide a cluster-level disaster recovery solution, or to implement data migration between clusters, data usually needs to be backed up to another cluster. Such a process is referred to as inter-cluster data synchronization. When a cluster to which a user accesses for reading or writing needs to be changed from a primary cluster to a secondary cluster, such change process is referred to as switching a primary cluster. How to ensure synchronization consistency of data between clusters and ensure that there is no impact on the user during cluster switching are key technical solutions for synchronization and switching between clusters.
Nowadays, technical solutions for synchronization are generally classified into an inter-cluster asynchronous synchronization solution and synchronous synchronization solution. They separately work in combination with different switching solutions:
First, in the asynchronous synchronization solution, an asynchronous module is used to copy data from a primary cluster to a secondary cluster. This solution may ensure data consistency but has a certain degree of latency. When switching needs to be performed on a primary cluster providing external services, some data on the primary cluster may not yet be synchronized to a secondary cluster. Consequently, this data is invisible to the user and there is transient data loss after switching and before the data is completely synchronized. In addition, during synchronization of the data, if the user overwrites the data, a data inconsistency problem may occur. Therefore, writing data into a primary cluster is stopped first when cluster switching is required. After all the data on the primary cluster is synchronized to a secondary cluster, the switching of the cluster is done. Then the user's write access is opened up. In this way, user access is not affected, and the data inconsistency problem can be solved. However, because of the latency, user usage is affected as the user is forbidden to write data into the cluster before switching.
Second, in the synchronous synchronization solution, a user writes data into a primary cluster and a secondary cluster separately, and cluster switching is simple. When the data is successfully written into both the primary cluster and the secondary cluster, a successful message is returned to the user. However, this will reduce the user's access successful rate and prolong user access delays. In addition, it is difficult to solve the data inconsistency problem caused when writing a piece of data between the primary cluster and the secondary cluster fails, and a problem that data existing in the primary cluster cannot be copied.